package io.kiki.sba.registry.compress;

import io.kiki.sba.registry.cache.Sizer;
import io.kiki.sba.registry.concurrent.CachedExecutor;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;


public class CompressCachedExecutor<V extends Sizer> extends CachedExecutor<CompressKey, V> {
    private static final Logger logger = LoggerFactory.getLogger(CompressCachedExecutor.class);
    private final String name;

    public CompressCachedExecutor(String name, long silentMs, long maxWeight) {
        super(silentMs, maxWeight, (CompressKey k, V v) -> k.size() + v.size(), true);
        this.name = name;
    }

    @Override
    protected void onMiss(CompressKey key) {
        logger.info("[CompressCacheMiss] executor {} on miss: {}", name, key);
    }
}
